package com.pengcheng.spring;

import com.pengcheng.spring.bean.Hello;
import com.pengcheng.spring.bean.HelloFactory;
import com.pengcheng.spring.bean.Person;
import com.pengcheng.spring.config.MainConfig;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class AnnotationMainTest {

	public static void main(String[] args) {
		ApplicationContext applicationContext = new AnnotationConfigApplicationContext(MainConfig.class);

		// 循环引用，原理测试
		Hello bean1 = applicationContext.getBean(Hello.class);

		Hello bean2 = applicationContext.getBean(Hello.class);


		System.out.println(bean1 == bean2);

//		Person bean = applicationContext.getBean(Person.class);
//		ApplicationContext context = bean.getContext();
//
//		System.out.println(context == applicationContext);

	}
}
